package com.mostromas.ess.product.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mostromas.ess.entities.*;
import com.mostromas.ess.product.req.ProductREQ;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ProductMapper extends BaseMapper<Product> {

    Product findDetails(@Param("productId") String productId);

    IPage<Product> selectPage(IPage<Product> page,@Param("req") ProductREQ req);

    /**
     * 级联保存款式颜色
     * @param colorList
     * @return
     */
    boolean saveProductRelationColor(@Param("productId") String productId,@Param("colorList") List<ProductColor> colorList);

    /**
     * 级联保存款式面料
     * @param fabricList
     * @return
     */
    boolean saveProductRelationFabric(@Param("productId") String productId,@Param("fabricList") List<Fabric> fabricList);

    /**
     * 级联保存款式细节图
     * @param styleList
     * @return
     */
    boolean saveProductRelationStyle(@Param("productId") String productId,@Param("styleList") List<ProductStyle> styleList);

    /**
     * 级联保存款式尺码
     * @param sizeList
     * @return
     */
    boolean saveProductRelationSize(@Param("productId") String productId,@Param("sizeList") List<ProductSize> sizeList);

    /**
     * 删除颜色中间表
     * @param productId
     * @return
     */
    boolean deleteProductRelationColor(@Param("productId") String productId);
    /**
     * 删除面料中间表
     * @param productId
     * @return
     */
    boolean deleteProductRelationFabric(@Param("productId") String productId);
    /**
     * 删除样式中间表
     * @param productId
     * @return
     */
    boolean deleteProductRelationStyle(@Param("productId") String productId);
    /**
     * 删除尺码中间表
     * @param productId
     * @return
     */
    boolean deleteProductRelationSize(@Param("productId") String productId);
}
